FROM quay.io/prometheus/busybox-linux-amd64:latest
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"

RUN  mkdir /alertmanager && cd /alertmanager && mkdir data cfg bin log

COPY ./bin/amtool  /alertmanager/bin/amtool
COPY ./bin/alertmanager  /alertmanager/bin/alertmanager
COPY ./cfg/start.sh     /alertmanager/cfg/start.sh
COPY ./cfg/alertmanager.yml  /alertmanager/cfg/alertmanager.yml

RUN chmod +x /alertmanager/cfg/start.sh 
RUN chmod +x /alertmanager/bin/alertmanager 
RUN chmod +x /alertmanager/bin/amtool

USER       root
EXPOSE     9093 9094
VOLUME     [ "/alertmanager" ]
WORKDIR    /alertmanager
CMD ["sh" ,"-c", "/alertmanager/cfg/start.sh"]